using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Comteck.Winforms.Tasks {
  /// <summary>
  /// 线程扩展方法
  /// </summary>
  public static class ThreadExtentions {


    /// <summary>
    /// 取时间戳
    /// </summary>
    /// <param name="datetime"></param>
    /// <returns></returns>
    public static string Close(this Thread thread) {
      string errorStr = string.Empty;

      try {
        thread?.Abort();
      } catch (Exception ex) {
        errorStr = $"线程退出异常：{ex.Message}";
      }

      return errorStr;
    }
  }
}
